﻿using RewriteWeatherApp.Base;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RewriteWeatherApp.CallBoard
{
    public class CurrentCondtionDisplay : IObserver, IDisplayElement
    {
        float temp, humidity;//温度 湿度
        public CurrentCondtionDisplay(IAccountsSubject subject)
        {
            subject.RegisterObserver(this);//执行关注方法 加入HashSet列表
        }
        public void DisPlay()
        {
            Console.WriteLine(nameof(CurrentCondtionDisplay));
            Console.WriteLine($"当前温度：{temp}  湿度：{humidity}");
        }

        public void Update(float temp, float humidity, float pressure)
        {
            this.temp = temp;
            this.humidity = humidity;
            DisPlay();
        }
    }
}
